package com.tlgen.rpc.config;

import com.tlgen.rpc.comon.R;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

import static com.tlgen.rpc.utils.MappingUtils.toMap;

public class FetchProxy<T> implements InvocationHandler, Serializable {

    Class<T> mapperInterface;

    public FetchProxy(Class<T> mapperInterface) {
        this.mapperInterface = mapperInterface;
    }

    @Override
    public R invoke(Object proxy, Method method, Object[] args) {
        return R.ok(toMap(method, args));
    }

}
